<div id="desc" style="display: none;">

{* свои желания ->> *}
{if $smarty.const.CAN_EDIT}
    {if !$new_present}
    <div id="p_view">
        <center>
            <h3>{$current_gift.name}</h3>
            {if $current_gift.image}<img src="{$gift_images_dir}/{$current_gift.image}" alt="{$current_gift.name}" />{/if}
        </center>
        <div class="desc_body">
            <div class="container" style="width: 100%; margin-bottom: 10px;">
                <div class="desc_btn" style="float: right;" onclick="pre_delete({$current_user}, {$current_gift.idpresents});"><a>{$lang.del_present_btn}</a></div> 
                {if $presenters_list}                                  
                <div class="desc_btn" id="info_btn"><a>{$lang.show_presenters_btn} ({if $new_users}{$lang.pr_new} &mdash; <b>{$new_users}</b>, {/if}{$lang.pr_total} &mdash; {$total_users})</a></div>  
                <div class="desc_info">
                            
                            {if $current_gift.amount_proposed > 0}
                            <ol>
                            <li><b>{$lang.proposed}</b></li>
                            {foreach from=$presenters_list.N item=person}
                                <li id="sub">
                                <a href="{$current_location}/{$person.idusers}">{$person.first_name} {$person.last_name}{if $person.login} ({$person.login}){/if}</a> {if $person.amount > 1}({$person.amount}){/if}
                                <div>{$person.proposal_date}</div>
                                <p id="user_{$person.idusers}">
                                    <span onclick="PresentAct({$current_gift.idpresents}, {$person.idusers}, 'approve');" title="{$lang.accept_offer}">
                                        <img src="{$skin_images_dir}/user_add.png" alt="{$lang.accept_offer}" /> <a>{$lang.accept_offer_btn}</a>
                                    </span>
                                    <span onclick="PresentAct({$current_gift.idpresents}, {$person.idusers}, 'deny');" title="{$lang.cancel_offer}">
                                        <img src="{$skin_images_dir}/user_delete.png" alt="{$lang.cancel_offer}" /> <a>{$lang.cancel_offer_btn}</a>
                                    </span>
                                </p>
                                </li>
                            {/foreach}
                            </ol>
                            {/if} 
                            {if $current_gift.amount_approved > 0}
                            <ol>
                            <li><b>{$lang.approved}</b></li>
                            {foreach from=$presenters_list.A item=person}
                                <li id="sub">
                                <a href="{$current_location}/{$person.idusers}">{$person.first_name} {$person.last_name}{if $person.login} ({$person.login}){/if}</a> {if $person.amount > 1}({$person.amount}){/if}
                                <div>{$person.approval_date}</div>
                                <p id="user_{$person.idusers}">
                                    <span onclick="PresentAct({$current_gift.idpresents}, {$person.idusers}, 'confirm');" title="{$lang.accept_gift}">
                                        <img src="{$skin_images_dir}/gift.png" alt="{$lang.accept_gift}" /> <a>{$lang.accept_gift_btn}</a>
                                    </span>
                                    <span onclick="PresentAct({$current_gift.idpresents}, {$person.idusers}, 'delete');" title="{$lang.cancel_gift}">
                                        <img src="{$skin_images_dir}/cancel.png" alt="{$lang.cancel_gift}" /> <a>{$lang.cancel_gift_btn}</a>
                                    </span>
                                </p>                           
                                </li>
                            {/foreach}
                            </ol>
                            {/if}
                            {if $current_gift.amount_presented > 0}
                            <ol>
                            <li><b>{$lang.presented}</b></li>
                            {foreach from=$presenters_list.P item=person}
                                <li id="sub">
                                <a href="{$current_location}/{$person.idusers}">{$person.first_name} {$person.last_name}{if $person.login} ({$person.login}){/if}</a> {if $person.amount > 1}({$person.amount}){/if}
                                <div>{$person.presented_date}</div>
                                </li>
                            {/foreach}
                            </ol>
                            {/if}
                            {if $current_gift.amount > 1}
                            <center><p style="color: gray;">{$lang.need_amount} {$current_gift.amount}{if $current_gift.amount_presented >= $current_gift.amount} | {$lang.all_presented}{elseif $current_gift.amount_left > 0} | {$lang.actual_amount}{$current_gift.amount_left}{else} | {$lang.all_accepted}{/if}</p></center>
                            {/if}
                        
                </div>
                {else}<div class="desc_btn" id="edit_btn"><a>{$lang.edit_present_btn}</a></div>
                {/if}
            </div>
            
        {if $current_gift.ev_name}
            <table>
            <tr>
                <td class="ev_date">{$current_gift.ev_date}</td>
                <td class="ev_name">{$current_gift.ev_name}</td>
            </tr>
            </table><p>&nbsp;</p>
        {/if}
        {if $current_gift.link}
            <a href="{$current_location}/{$index_script}?{$place_name}=out&link={$current_gift.link_hash}" rel="nofollow">{$current_gift.short_link}</a>
            <br><br>
        {/if}
            {$current_gift.description}
        </div>
       {* <div class="give_btn" style="float: right; margin-top: -10px;">{$lang.edit_present_btn}</div>*}
     </div>
     
     {/if}
     
     <div id="p_edit" {if !$new_present}style="display: none;"{/if}>  
        <form accept-charset="utf-8" action="{$current_location}/{$index_script}?id={$smarty.session.id}&{$place_name}=presents_ajax&{$mode_name}=add&ajax=yes" name="new_present_form" id="ajax_form" method="{$form_method}">
            <center style="margin-bottom: 10px;">
            {if !$new_present}
                {include file="button.tpl" name=$lang.save_present_btn submit=true}
                {include file="button.tpl" href="pre_delete($current_user, `$current_gift.idpresents`);" name=$lang.del_present_btn}
                &nbsp;{$lang.or}&nbsp;                                      
                <a href="{$current_location}/{$smarty.session.id}/{$current_gift.idpresents}">{$lang.cancel_btn}</a>
                
            {else}
                {include file="button.tpl" name=$lang.add_present_btn submit=true}
            {/if}
            </center>        
            <input type="hidden" name="prid" value="{$current_gift.idpresents}">
            <input type="hidden" name="pr[idevent]" value="{$current_gift.idevent}">
            <input class="input-text" name="pr[name]" maxlength="100" style="width: 78%; font-weight: bold;" value="{$current_gift.name}" title="{$lang.pr_name_hint}" />
            {if $smarty.const.MULTIPLE_AMOUNT}  
            <input class="input-text" name="pr[amount]" maxlength="100" style="width: 16%;" value="{$current_gift.amount}" title="{$lang.pr_count_hint}" />
            {/if}  
            <input class="input-text" name="oc[name]" maxlength="190" style="width: 78%;" value="{$current_gift.ev_name}" title="{$lang.pr_occasion_hint}" />
                <script type="text/javascript">
                {literal}
                //<![CDATA[
                        $("#calendar").datepicker({ changeMonth: true, changeYear: true});
                        $('#ui-datepicker-div').hide(); /*   добавил, чтобы убрать появляющийся пустой прямоугольник при инициализации календаря (какой-то глюк похоже)   */
                //]]>
                {/literal}
                </script> 
            <input class="input-text" name="oc[date]" maxlength="10" style="width: 16%;" value="{$current_gift.ev_date}" title="{$lang.pr_occasion_date_hint}" id="calendar" />
            <input class="input-text" name="pr[link]" maxlength="100" style="width: 78%;" value="{$current_gift.link}" title="{$lang.pr_link_hint}" />
            <div style="width: 100%; margin-left: 1px;">
                <script type="text/javascript" src="{$scripts_dir}/nicedit/nicEdit.js"></script> 
                <script type="text/javascript"> 
                {literal}
                //<![CDATA[
                        new nicEditor({iconsPath : scripts_dir + '/nicedit/nicEditorIcons.gif', buttonList : ['bold','italic','underline','strikeThrough','left','center','right','justify','ol','ul','hr','forecolor','bgcolor','removeformat']}).panelInstance('description');
                //]]>
                {/literal}
                </script>        
                <textarea name="pr[description]" id="description" style="width: 400px; height: 150px;" title="{$lang.pr_desc_hint}">{if $current_gift.description}{$current_gift.description}{else}{$lang.pr_desc_hint}{/if}</textarea>
            </div>
            <input type="hidden" name="pr[uploaded_img]" value="" id="uploaded_img"> 
            <input type="hidden" name="pr[uploaded_thumb]" value="" id="uploaded_thumb"> 
        </form>
        <br>
        <center>
            {if $current_gift.image}
                {include file="select_image.tpl" delid=$current_gift.idpresents what="pr_image" img="$current_location/`$smarty.const.GIFT_IMAGES_DIR`/`$current_gift.image`"}
            {else}
                {include file="select_image.tpl"}
            {/if}
        </center> 
     </div>
{* <<- свои желания *}
     
     
{* чужие желания ->> *}
{else}
    <center><h3>{$current_gift.name}</h3></center>
    <div class="desc_body">
    {if $current_gift.ev_name}
        <table>
        <tr>
            <td class="ev_date">{$current_gift.ev_date}</td>
            <td class="ev_name">{$current_gift.ev_name}</td>
        </tr>
        </table><p>&nbsp;</p>
    {/if}
    
  {*  {if $can_give == ""} <div class="give_btn" title="{$lang.give_hint}">{$lang.give}</div>
    {elseif $present.mygift_approved == "N"} <div class="give_btn.me_proposed" title="{$lang.me_proposed_hint}">{$lang.me_proposed}</div>
    {elseif $present.mygift_approved == "A"} <div class="give_btn.me_approved" title="{$lang.me_approved_hint}">{$lang.me_approved}</div>
    {elseif $present.mygift_approved == "P"} <div class="give_btn.me_presented" title="{$lang.me_gived_hint}">{$lang.me_gived}</div>
    {elseif $present.amount_presented >= $present.amount} <div class="give_btn.other_presented" title="{$lang.other_gived_hint}">{$lang.gived}</div>
    {elseif $present.amount_presented >= $present.amount} <div class="give_btn.other_presented" title="{$lang.other_gived_hint}">{$lang.gived}</div>}
    {else} <div class="give_btn.error" title="{$can_give}">{$lang.cant_give_btn}</div>
    {/if}   *}     
    
    
    {if $can_give == ""} <div class="give_btn">{$lang.gift_confirm_btn}</div>
    {else}
        <div class="give_btn error">{$can_give}
        {if $current_gift.mygift_approved == 'A' || $current_gift.mygift_approved == 'N'}
        <p style="margin-top: 5px;">
            <span onclick="PresentAct({$current_gift.idpresents}, {$current_gift.user}, 'abandon');" title="{$lang.cancel_my_offer}" class="link_btn">
                <img src="{$skin_images_dir}/cancel.png" alt="{$lang.cancel_my_offer}" /> <a>{$lang.cancel_my_offer_btn}</a>
            </span>
        </p>
        {/if}
        </div>
    {/if}
    
    <center>{if $current_gift.image}<img src="{$gift_images_dir}/{$current_gift.image}" alt="{$current_gift.name}" style="margin-top: 10px;" />{/if}</center>
    
    <br><br>
    
    <form name="give_form">
    <div class="msg_bg"></div>
    <div class="give_form">
        <table>
            <tr>
                <td width="100%" align="left" style="color: silver;">{$lang.give}</td><td><img class="msg_close" src="{$skin_images_dir}/close_icon.gif"></td>
            </tr>
        </table>
        <br>
        {if $can_give == ""}
        {if $current_gift.amount > 1}
        <p><label>{$lang.gift_amount}: </label><strong>{$current_gift.amount}</strong></p>
        <p><label>{$lang.gift_amount_left}: </label><strong>{$current_gift.amount_left}</strong></p>
        <br>
        {$lang.gift_ill_give}:&nbsp;
        <input id="give_count" name="give_count" maxlength="10" value="1" style="width: 40px; text-align: center;" onfocus="this.select();">
        <br><br>        
        {/if}
        <b>{$lang.gift_really}</b>
        <p id="btn" title="{$lang.gift_btn_hint}">{include file="button.tpl" href="give(`$current_gift.idpresents`, `$current_gift.amount_left`);" name=$lang.gift_confirm_btn}</p>
        {else}
        <b>{$can_give}</b>
        {/if}
    </div>
    </form>
        
    
    {if $current_gift.link}
        <a href="{$current_location}/{$index_script}?{$place_name}=out&link={$current_gift.link_hash}" rel="nofollow">{$current_gift.short_link}</a>
        <br><br>
    {/if}
        {$current_gift.description}
    </div>
{/if}
{* <<- чужие желания *}

</div>  